package org.coding.springbootdemocommandline.beanlife;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author guoxuehe
 * @date 2021/1/26 15:56
 * @desc
 **/
public class Main {
    public static void main(String[] args) {
        System.out.println("现在开始初始化容器");
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        System.out.println("容器初始化成功");
        Person person = context.getBean("person",Person.class);
        System.out.println(person);
        System.out.println("现在开始关闭容器");
        ((ClassPathXmlApplicationContext)context).registerShutdownHook();
    }
}
